/*

 */
package com.ohos.connent.accountcloud.biz.modular.dp.enums;

import com.ohos.connent.accountcloud.common.exception.CommonException;
import lombok.Getter;

/**
 * 机构状态枚举
 *0-待审核；1-已认证；2-已驳回；3-冻结
 **/
@Getter
public enum DpOrgStatusEnum {

    /** 待审核 */
    PENDING_REVIEW("待审核",0),

    /** 已认证 */
    VERIFIED("已认证",1),

    /** 已驳回 */
    REJECTED("已驳回",2),

    /** 冻结 */
    FROZEN("冻结",3);

    private final String value;
    private final int status;

    DpOrgStatusEnum(String value, int status) {
        this.value = value;
        this.status = status;
    }

    public static void validateCertified(Integer status) {
        if (status == REJECTED.getStatus() || status == VERIFIED.getStatus()) {
            return;
        }
        throw new CommonException("无效的参数：status，参数只能填写：{},{}", VERIFIED.getStatus(), REJECTED.getStatus());
    }

    public static void validateFrozen(Integer status) {
        if (status == FROZEN.getStatus() || status == VERIFIED.getStatus()) {
            return;
        }
        throw new CommonException("无效的参数：status，参数只能填写：{},{}", VERIFIED.getStatus(), FROZEN.getStatus());
    }
}
